One way of measuring the efficiency of a TCP connection is by measuring how much of the traffic that is sent as part of the connection is retransmitted. Retransmissions occur when the sending node does not receive an acknowledgement, within a predetermined time interval, of receipt of a packet at the receiving node. This can be due to either loss or delay of either the original packet or the acknowledgement.
Each TCP packet is accompanied by a sequence number (the packet's position in the sending node's output buffer, measured in bytes from the beginning of the buffer plus a random offset which is chosen at the start of a connection to avoid simultaneous use of duplicate sequence number values). A TCP length (the amount of TCP payload data transferred) can also be calculated for each TCP packet, by subtracting the IP and TCP header lengths from the total length of the overall IP packet. By recording the first and last sequence numbers for each direction of a TCP connection it is possible to calculate the amount of traffic successfully transmitted as part of the connection. This is accomplished by subtracting the first sequence number from the last, making an allowance for signalling packets such as SYN (synchronise sequence numbers) and FIN (data transfer finished) which increment the sequence number without transmitting any payload. The resulting measurement of total transmitted traffic is referred to herein as “goodput”.
One conventional way to measure TCP retransmission is to measure the volume of transmitted TCP payload (i.e. the aggregate of all TCP packets including both original and retransmitted packets), by summing the TCP packet lengths, and then subtract the TCP goodput. When this measurement is made at the location of the sending TCP node it produces an accurate measure of the retransmissions, as the measure of the total transmitted volume is indeed the actual volume—none has yet been lost.
However if the measurement is made at a point where some of the IP packets may have already been lost then the retransmission measurement will undercount by the amount of the loss. In the case where the retransmissions are due to loss of data packets (as opposed to delay or loss of acknowledgements) then this loss can mask out the retransmissions and give the connection a flatteringly low retransmission count.